package xkp.lesson3;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

public class TestGetObject {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        ObjectInputStream inputStream = new ObjectInputStream(
                new FileInputStream("Lesson25/file/person"));
        //从流中读取数据
        Person person2 = (Person) inputStream.readObject();
        //在文件中存储的是对象的字节数据
        //把字节数据转换为对象的过程为反序列化
        System.out.println(person2);
        inputStream.close();
    }
}
